using System;
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.Ccr.Core;
using Microsoft.Dss.Core.Attributes;
using Microsoft.Dss.ServiceModel.Dssp;
using Microsoft.Dss.ServiceModel.DsspServiceBase;
using W3C.Soap;

namespace Bettzueche.Robotics.CommPerformanceCounter {
    /// <summary>
    /// CommPerformanceCounter contract class
    /// </summary>
    public sealed class Contract {
        /// <summary>
        /// DSS contract identifer for CommPerformanceCounter
        /// </summary>
        [DataMember]
        public const string Identifier = "http://schemas.haw-hamburg.de/2010/07/commperformancecounter.html";
    }

    /// <summary>
    /// CommPerformanceCounter state
    /// </summary>
    [DataContract]
    public class CommPerformanceCounterState {
        [DataMember]
        [Description("Counts IncrementCount-Requests")]
        public int Count { get; set; }
    }

    /// <summary>
    /// CommPerformanceCounter main operations port
    /// </summary>
    [ServicePort]
    public class CommPerformanceCounterOperations : PortSet<
        DsspDefaultLookup,
        DsspDefaultDrop,
        Get,
        IncrementCount,
        SetPerformanceCounter> {
    }

    [Description("Service operation to increment the Counter for incoming Messages.\n" +
                  "WARNING: actual implementation does not respond!")]
    public class IncrementCount : Update<IncrementCountRequest, PortSet<Success, Fault>> {
        //only inherited members
    }

    [Description("Service operation to update the Win Performance Counter \"messages per seconds\"")]
    public class SetPerformanceCounter : Submit<SetPerformanceCounterRequest, PortSet<DefaultSubmitResponseType, Fault>> {
        //only inherited members
    }

    [DataContract]
    [Description("Request to increment the Counter for incoming Messages")]
    public class IncrementCountRequest {
        // no content
    }

    [DataContract]
    [Description("Request to update the Win Performance Counter")]
    public class SetPerformanceCounterRequest {
        // no content
    }

    [DataContract]
    [Description("Indicates the success of an activity")]
    public class Success {
        //no content
    }

    /// <summary>
    /// CommPerformanceCounter get operation
    /// </summary>
    public class Get : Get<GetRequestType, PortSet<CommPerformanceCounterState, Fault>> {
        /// <summary>
        /// Creates a new instance of Get
        /// </summary>
        public Get() {
        }

        /// <summary>
        /// Creates a new instance of Get
        /// </summary>
        /// <param name="body">the request message body</param>
        public Get(GetRequestType body)
            : base(body) {
        }

        /// <summary>
        /// Creates a new instance of Get
        /// </summary>
        /// <param name="body">the request message body</param>
        /// <param name="responsePort">the response port for the request</param>
        public Get(GetRequestType body, PortSet<CommPerformanceCounterState, Fault> responsePort)
            : base(body, responsePort) {
        }
    }
}
